home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / Draw / Sources / GroupShp.h < prev    next >
Encoding:
Text File  |  1996-12-16  |  5.4 KB  |  177 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                GroupShp.h
  4. //    Release Version:    $ ODF 3 $
  5. //
  6. //    Author:                Mary Boetcher
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef GROUPSHP_H
  13. #define GROUPSHP_H
  14.  
  15. #ifndef CONSTANT_H
  16. #include "Constant.h"
  17. #endif
  18.  
  19. #ifndef BASESHP_H
  20. #include "BaseShp.h"
  21. #endif
  22.  
  23. // ----- OS Layer -----
  24.  
  25. #ifndef FWINK_H
  26. #include "FWInk.h"
  27. #endif
  28.  
  29. #ifndef FWSTYLE_H
  30. #include "FWStyle.h"
  31. #endif
  32.  
  33. #ifndef FWPOINT_H
  34. #include "FWPoint.h"
  35. #endif
  36.  
  37. #ifndef FWRECT_H
  38. #include "FWRect.h"
  39. #endif
  40.  
  41. // ----- Foundation Layer -----
  42.  
  43. #ifndef FWRUNTYP_H
  44. #include "FWRunTyp.h"
  45. #endif
  46.  
  47. //========================================================================================
  48. // Forward Declarations
  49. //========================================================================================
  50.  
  51. class ODFacet;
  52. class ODShape;
  53. class CDrawPart;
  54. class FW_CGraphicContext;
  55. class FW_CMouseEvent;
  56.  
  57. class CDrawFacetClipper;
  58. class CUngroupShapesCommand;
  59. class CDrawContent;
  60.  
  61. //========================================================================================
  62. // class CGroupShape
  63. //========================================================================================
  64.  
  65. class CGroupShape : public CBaseShape
  66. {
  67.   public:
  68.     FW_DECLARE_CLASS
  69.     FW_DECLARE_AUTO(CGroupShape)
  70.  
  71.   public:
  72.     CGroupShape(CDrawPart* drawPart);
  73.     CGroupShape(CDrawPart* drawPart, CShapeCollection* shapeList);
  74.     CGroupShape(CDrawPart* drawPart, FW_CReadableStream& archive);
  75.     
  76.   public:
  77.     virtual ~CGroupShape();
  78.                 
  79.   public:
  80.     // ----- Archiving -----
  81.     static void*         Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  82.     virtual void         Flatten(FW_CWritableStream& archive);
  83.  
  84.     // ----- Required CBaseShape overrides -----
  85.     virtual ODShape*    CreateShapeOutline(Environment* ev);
  86.     virtual ODShape*    CalcClipShape(Environment* ev);
  87.     virtual void        GetHandleCenter(short whichHandle, FW_CPoint& center) const;
  88.     virtual void        GetMapRects(short whichHandle, const FW_CPoint& lastLocation,
  89.                                     FW_CRect& srcRect, FW_CRect& dstRect);
  90.     virtual FW_CRect    GetRectGeometry() const;
  91.     virtual FW_Boolean    HitTest(Environment* ev, FW_CGraphicContext& gc, const FW_CMouseEvent& theMouseEvent) const;
  92.     virtual void        MapShape(Environment* ev, const FW_CRect& srcRect, const FW_CRect& dstRect);
  93.     virtual void        OffsetShape(Environment* ev, FW_Fixed xDelta, FW_Fixed yDelta);
  94.     virtual void        RenderShape(Environment* ev, ODFacet* facet, FW_CGraphicContext& gc);
  95.     virtual void        ResizeFeedback(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style, 
  96.                                         short whichHandle, const FW_CPoint& mouseLoc);
  97.     virtual void        SetShapeGeometry(const FW_CPoint& anchorPoint,  const FW_CPoint& currentPoint);
  98.  
  99.     // ----- Other CBaseShape overrides -----
  100.     virtual void        Deleted(Environment* ev);
  101.     virtual void        Removed(Environment* ev);
  102.     virtual void        RestoreShape(Environment* ev);
  103.  
  104.     virtual void         SelectShape(Environment* ev, FW_Boolean state);
  105.     virtual void        SubtractToWorkingClip(Environment* ev, 
  106.                                             CDrawFacetClipper* facetClipper, 
  107.                                             ODFacet* containingFacet, 
  108.                                             ODShape* workingClip,
  109.                                             ODShape* tempShape,
  110.                                             ODShape* limitShape);
  111.  
  112.     virtual void        SetSubscribeLink(Environment* ev, CDrawSubscribeLink* subscribeLink);
  113.     virtual void        MakePurgeable(Environment* ev, CDrawFrame* drawFrame, const FW_CRect& bounds);
  114.     virtual void         ShapeCommitPasteDone(Environment* ev);
  115.  
  116.     // ----- Shape shifting -----
  117.     virtual void        ChangeFrameColor(Environment* ev, const FW_CColor& color);
  118.     virtual void        ChangeFramePattern(Environment* ev, const FW_CPattern& pattern);
  119.     virtual void        ChangeFillColor(Environment* ev, const FW_CColor& color);
  120.     virtual void        ChangeFillPattern(Environment* ev, const FW_CPattern& pattern);
  121.     virtual void        ChangePenSize(Environment* ev, FW_Fixed newPenSize);
  122.     virtual void        ChangeRenderVerb(Environment* ev, unsigned short renderVerb);
  123.  
  124.     // ----- Shape list operations -----
  125.     void                AddShape(CBaseShape* shape);
  126.     unsigned long        CountShapes() const;
  127.     unsigned long        CountProxyShapes(Environment* ev) const;
  128.     void                EmptyShapes();
  129.     CBaseShape*            GetFirstShape() const;
  130.     void                RemoveShapes();
  131.     void                Remove1Shape(CBaseShape* shape);
  132.  
  133.     CShapeCollection*    GetShapeList();
  134.  
  135.   private:
  136.     void                 OutlineShape(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style, const FW_CRect& rect);
  137.  
  138.   private:
  139.     CShapeCollection*    fShapeList;    // list of CBaseShape*
  140. };
  141.  
  142. //----------------------------------------------------------------------------------------
  143. inline CShapeCollection* CGroupShape::GetShapeList()
  144. {
  145.     return fShapeList;
  146. }
  147.  
  148. //========================================================================================
  149. //    class CAllShapeIterator - iterate grouped shapes recursively
  150. //========================================================================================
  151.  
  152. class CAllShapeIterator
  153. {
  154.   public:
  155.     FW_DECLARE_AUTO(CAllShapeIterator)
  156.  
  157.     CAllShapeIterator(CShapeCollection* shapeList);
  158.     CAllShapeIterator(CDrawContent* content);
  159.     ~CAllShapeIterator();
  160.  
  161.     CBaseShape*    First();
  162.     CBaseShape*    Next();
  163.     FW_Boolean    IsNotComplete();
  164.     CBaseShape*    Last();
  165.     CBaseShape*    Previous();
  166.  
  167.     unsigned long CountShapes();
  168.  
  169.   private:
  170.     void        PrivFlattenList(CShapeCollection* shapeList);
  171.  
  172.     CShapeCollectionIterator*    fIter;
  173.     CShapeCollection*            fTempList;        // flattened list - temporary
  174. };
  175.  
  176. #endif
  177.